package ru.ccfit.nsu.g7204.dronov.adPlatform;

/**
 * Created by IntelliJ IDEA.
 * User: Drongo
 * Date: 22.03.11
 * Time: 14:49
 * To change this template use File | Settings | File Templates.
 */
public class BannerFeatureInfo {
    private Feature feature;
    private double weight;

    public BannerFeatureInfo(int id, String info, double weight) {
      feature=new Feature(id,info);
        this.weight = weight;
    }

    public BannerFeatureInfo(Feature feature, double weight) {
        this.feature = feature;
        this.weight = weight;
    }

    public Feature getFeature() {
        return feature;
    }

    public double getWeight() {
        return weight;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        BannerFeatureInfo that = (BannerFeatureInfo) o;

        if (Double.compare(that.weight, weight) != 0) return false;
        if (feature != null ? !feature.equals(that.feature) : that.feature != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result;
        long temp;
        result = feature != null ? feature.hashCode() : 0;
        temp = weight != +0.0d ? Double.doubleToLongBits(weight) : 0L;
        result = 31 * result + (int) (temp ^ (temp >>> 32));
        return result;
    }
}
